﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NapCardOnline.Models
{
    public partial class ServiceCost
    {
        public static List<ServiceCost> GetServiceCostByServiceId(int serviceId)
        {
            using (var db = new NapCardOnlineEntities())
            {
                return db.ServiceCosts.Include("Cost").Include("Service").Where(s => s.FK_ServiceID == serviceId).ToList();
            }
        }

        /// <summary>
        /// Gets the service cost by service cost id.
        /// </summary>
        /// <param name="serviceCostId">The service cost id.</param>
        /// <returns>The service cost object</returns>
        public static ServiceCost GetServiceCostByServiceCostId(int serviceCostId)
        {
            using (var db = new NapCardOnlineEntities())
            {
                var objServiceCost = db.ServiceCosts.FirstOrDefault(s => s.ServiceCostID == serviceCostId);
                if (objServiceCost != null)
                {
                    return objServiceCost;
                }
                return null;
            }
        }
    }
}